<%-- 
    Document   : main
    Created on : 2016-12-7, 9:20:12
    Author     : 52461
--%>

<%@page import="com.cxhd.pacs.DataConfig"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
         <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <title><%=DataConfig.getInstance().getConfig().get("systemName")%></title>
        <link rel="icon" href="${base}/favicon.ico" type="image/x-icon">
        <link href="${base}/css/bootstrap.css" rel="stylesheet">
        <link href="${base}/css/font-awesome.css" rel="stylesheet">
        <link href="${base}/css/material-kit.css" rel="stylesheet">
        <link rel="stylesheet" href="${base}/css/nprogress.css"/>

        <script type="text/javascript" src="${base}/js/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="${base}/js/material.min.js"></script>
        <script type="text/javascript" src="${base}/js/material-kit.js"></script>
        <script type="text/javascript" src="${base}/js/angular/angular.min.js"></script>
        <script type="text/javascript" src="${base}/js/angular-base.js"></script>
        <script type="text/javascript" src="${base}/js/angular/ui-bootstrap-tpls-0.12.0.min.js"></script>
        <script type="text/javascript" src="${base}/js/jquery.cxhd.js"></script>
        <script type="text/javascript" src="${base}/js/nprogress.js"></script>
        <style type="text/css">
            *{margin:0;padding:0;}
            .content_x{
                position: relative;
                width: 100%;
                height: 100%;
            }
            .search_x{
                position: relative;
                width: 100%;
                height:50px;
                border-bottom: 1px #23527c dashed;
            }
            .search_content{
                position: absolute;
                overflow: auto;
                top: 0px;
                bottom: 30px;
                width: 100%;
            }
            .mypage{
                position: absolute;
                bottom: 0px;
                width: 100%;
                margin: 0px;
            }
        </style>
    </head>
    <body ng-app="main" style="font-family: 微软雅黑;height: 100%;overflow: hidden" ng-controller="mainCtrl">
        <div class="col-lg-12" style="margin-top: 20px;">
            <div class="panel panel-default">
                <div class="panel-heading ">
                    <lable class="text-success" style="margin-right: 10px; font-weight: bold">病历号：<span ng-bind="data.pat_id"></span></lable>
                    <lable class="text-success" style="margin-right: 10px; font-weight: bold">姓名：<span ng-bind="data.name"></span></lable>
                    <lable class="text-success" style="margin-right: 10px; font-weight: bold">性别：<span ng-bind="data.sex"></span></lable>
                    <lable class="text-success" style="margin-right: 10px; font-weight: bold">年龄：<span ng-bind="data.age"></span></lable>
                </div>
                <table id="main" class="table">
                    <tr>
                        <td width="27%" style="border-right: 1px #23527c dashed;padding: 0px;">

                            <div class="content_x">

                                <div class="search_content">
                                    <table class="table table-striped">
                                        <tr>
                                            <th style="min-width: 40px">名称</th>
                                            <th></th>
                                            <th style="min-width: 120px">内容</th>
                                            <th>时间</th>
                                        </tr>
                                        <tr id="item_{{$index}}" ng-repeat=" item in lists">
                                            <td width="45px" >
                                                <span ng-bind="item.event_name"></span>

                                            </td>
                                            <td width="20px">
                                                <a style="cursor: pointer" ng-click="openImage(item,$index)" ng-if="item.event_name == 'US'"><span  class="fa fa-image"></span></a>

                                                <a style="cursor: pointer" ng-click="openImage(item,$index)" ng-if="item.event_name == 'DX'"><span  class="fa fa-image"></span></a>

                                                <a style="cursor: pointer" ng-click="openImage(item,$index)" ng-if="item.event_name == 'CT'"><span  class="fa fa-image"></span></a>

                                                <a style="cursor: pointer" ng-click="openImage(item,$index)" ng-if="item.event_name == 'MRI'"><span  class="fa fa-image"></span></a>

                                            </td>
                                            <td  ng-click="select(item, $index)" ng-bind="item.event_description"></td>
                                            <td  ng-click="select(item, $index)" width="160px" ng-bind="item.event_time"></td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="mypage" style="width: 100%;text-align: center">
                                    <pagination ng-change="pageChanged()" previous-text="上一页" next-text="下一页" first-text="第一页" last-text="最后一页" ng-model="data.currentPage" items-per-page="data.pageSize" total-items="data.bigTotalItems" ng-model="data.bigCurrentPage" max-size="data.maxSize" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination>

                                </div>
                            </div>
                        </td>
                        <td style="border-right: 1px #23527c dashed">
                            <div class="content_x">                                
                                <iframe src="" id="iframepage" name="iframepage" frameBorder=0 scrolling=auto width="100%"  ></iframe>
                            </div>
                        </td>

                    </tr>
                </table>
                <!--                <div class="panel-body">
                
                
                                    sfsdfsdfsdf
                                </div>-->
            </div>
        </div>
    </body>
</html>
<script>

    angular.module('main', ['ui.bootstrap', "baseModule"])
            .controller('mainCtrl', function ($scope, base) {
                $scope.data = {currentPage: 1};
                $scope.data.pat_id = unescape("<%=request.getAttribute("pat_id")%>".replace("null", ""));
                $scope.data.name = unescape("<%=request.getAttribute("name")%>".replace("null", ""));
                $scope.data.sex = unescape("<%=request.getAttribute("sex")%>".replace("null", ""));
                $scope.data.age = unescape("<%=request.getAttribute("age")%>".replace("null", ""));
                $("#iframepage").attr("src", "pat/chart?pat_id=" + $scope.data.pat_id + "&name=" + $scope.data.name + "&sex=" + $scope.data.sex);


                //体检项目
                $scope.currentPage = 1;
                $scope.pageChanged = function () {
                    $scope.getItem();
                };
                $scope.data.maxSize = 5;
                $scope.data.bigTotalItems = 20;
                $scope.data.bigCurrentPage = 1;
                $scope.data.pageSize = 20;
                $scope.getItem = function () {
                    base.post("pat/getItem", $scope.data).get(function (data) {
                        console.log(data);
                        $scope.lists = data.list;


                        $scope.data.bigTotalItems = data.totalRow;
                    });
                }

                $scope.select = function (item, index) {
                    $(".search_content").find(".success").removeClass("success");
                    $("#item_" + index).addClass("success");
                    $("#iframepage").attr("src", "pat/result?pk=" + item.pk);


                }
                $scope.openImage = function (item,index) {
                    $(".search_content").find(".success").removeClass("success");
                    $("#item_" + index).addClass("success");
                    $("#iframepage").attr("src", "pat/result?pk=" + item.pk);
                    $("#iframepage").attr("src", "/MedicalDesktop/admin/2016/simpleImgs.jsp?diuid=" + item.update_id);
                }
                $scope.getItem();





            })


    function autoHeight() {
        var bHeight = $(window).height();


        $("#main").height(bHeight - 85);
        $("#iframepage").height(bHeight - 100);

    }
    autoHeight();


    $(window).resize(function () {
        autoHeight();
    });
</script>
